package com.qfedu.aunt.commons.controller;


import com.qfedu.aunt.commons.aop.BehaviorLog;
import com.qfedu.aunt.commons.dto.PermDTO;
import com.qfedu.aunt.commons.pojo.Perm;
import com.qfedu.aunt.commons.result.R;
import com.qfedu.aunt.commons.service.UserService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author xiaobobo
 * @since 2022-10-31
 */
@RestController
@RequestMapping("/aunt/commons/user")
@Api(tags = "用户模块",description = "用户模块")
public class UserController {

    @Autowired
    private UserService  userService;

    /**
     * 通过token找菜单
     * @param req
     * @return
     */
    @ApiOperation(value = "通过token找菜单")
    @GetMapping("/getMenuByToken")
    @BehaviorLog(methodName = "通过token获取菜单",modelName = "用户模块")
    public R getMenuByToken(HttpServletRequest req){
        List<PermDTO> permList= userService.findMenuByToken(req);
        //最终将菜单信息返回给前端
        return R.ok().setData("menuList",permList);
    }





}

